package org.jeecg.modules.car.mapper;

import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.jeecg.entity.basedata.BaseFloor;
import org.jeecg.entity.basedata.BaseRoom;
import org.jeecg.entity.car.CarInfo;
import org.jeecg.modules.car.entity.CarParkInfo;
import org.jeecg.modules.car.entity.CyRoomCheckUser;

import java.util.List;

/**
 * @Description: 月卡车列表
 * @Author: jeecg-boot
 * @Date: 2019-07-10
 * @Version: V1.0
 */
public interface CarInfoMapper extends BaseMapper<CarInfo> {
    int deleteByPrimaryKey(Integer id);
    int insertSelective(CarInfo record);

    CarInfo selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(CarInfo record);

    int updateByPrimaryKey(CarInfo record);

    /**
     * 根据用户id查询用户是否第一次申请非机动车
     *
     * @param userId
     * @return
     */
    public List<CarInfo> selectFirst(@Param("userId") String userId);

    public List<CarInfo> selectCarByRoomId(@Param("roomId") String roomId);

    public List<CarInfo> getRegListByProjectId(CarParkInfo carPark);


    /**
     * 查询房间号所在的小区
     *
     * @param roomId
     * @return
     */
    String selectProjectIdByRoomId(@Param("roomId") String roomId);

    /**
     * 获取最后物业费的缴纳时间
     *
     * @param roomId
     * @return string 缴纳时间(yyyyMM)
     */
    String getLastPropertyFeeDate(@Param("roomId") String roomId);

    /**
     * 获取业主所在房间
     *
     * @param userId
     * @return string 缴纳时间(yyyyMM)
     */
    List<BaseRoom> getRoomByUserId(@Param("userId") String userId);

    /**
     * 获取业主所在房间
     *
     * @param customerId
     * @return string 缴纳时间(yyyyMM)
     */
    BaseRoom getRoomIdByCustomerId(@Param("customerId") String customerId);

    List<CyRoomCheckUser> findRoomCheckByUserId(@Param("userId") String userId, @Param("projectId") String projectId, @Param("auditRes") String auditRes);


    /**
     * 查询房屋信息
     */
    public String selectRoomInfo(@Param("roomId") String roomId);

    CarInfo pageGet(String id);

    List<CarInfo> findAllPropertySyncCars();

    List<CarInfo> findCarByUserId(@Param("UserId") String UserId);

    List<CarInfo> findCarByCarNo(@Param("carNo") String carNo);

    List<CarInfo> findPage(Page<CarInfo> page, @Param("carInfo") CarInfo carInfo);

    void updateCheckStatus(@Param("carInfo") CarInfo carInfo);

    CarInfo selectByCarPortIdCarNum(@Param("carPortId") String carPortId);

    public BaseRoom getRoomByRoomNameCusName(@Param("floorId") String floorId, @Param("roomName") String roomName, @Param("cusName") String cusName);

    public BaseRoom getRoomByRoomNameTent(@Param("floorId") String floorId, @Param("roomName") String roomName, @Param("tentName") String tentName);

    public BaseFloor getFloorByName(@Param("floorName") String floorName, @Param("projectId") String projectId);

    @SqlParser(filter = true)
    void updateFeeDate(@Param("carInfo") CarInfo carInfo);

    @SqlParser(filter = true)
    CarInfo getByCarNo(@Param("carNo") String plateNumber, @Param("parkId") String parkId);
    @SqlParser(filter = true)
    CarInfo getByCarId(@Param("id") String id);

    @SqlParser(filter = true)
    List<CarInfo> findByIds(@Param("ids") List<String> carIdList);

    List<CarInfo> findByIds1();

    void updateSyncStatus(@Param("id") String id);

    Integer getCountByRuleId(@Param("ruleId") String ruleId);

    /** 查询有订单的车辆 */
    @SqlParser(filter = true)
    List<CarInfo> getAllOrderCarList(@Param("templateType") String templateType);

    @SqlParser(filter = true)
    List<CarInfo> getByCarPortId(@Param("carPortId") String carPortId);

    public BaseRoom getRoomByProjectFloorRoomName(@Param("baseRoom") BaseRoom baseRoom);

    @SqlParser(filter = true)
    List<CarInfo> getMonthCarNo(@Param("parkId") String parkId, @Param("tenantId") String tenantId,@Param("carNoIds") List<String> carNoIds);

    List<String> getCarIdByCarPortNum(@Param("carPortNum") String carPortNum);

    @SqlParser(filter = true)
    void updateIsExist(@Param("id") String id,@Param("tenantId") String tenantId,@Param("isExit") Integer isExit);
    @SqlParser(filter = true)
    List<CarInfo> findByParkId(String parkId);
}
